#code by colin#

from framework import Framework

from worker import Worker                   
from numpy import *                         #allow data to be process to acquire co-relationship
from matplotlib.pyplot import *             #allow the use of matplotlib for graphing

class Question2(Worker): #Subclasses Worker
    def __init__(self,framework): #gets passed the framework when created
        Worker.__init__(self,framework)
        self.title = 'Question 2'

    def get_result(self):                  #function to be written into html later on
        ds=self.small_dataset              #get data from small data set
        reviews = []                       #declare reviews is a list
        metas = []                         #declare meta is a list
        for row in ds:                     #to add a loop to read data from imported csv
            reviews.append(float(row[12])) #add values to review list
            metas.append(float(row[11]))   #add values to metascore list
        corr = corrcoef([array(reviews),array(metas)])[0][1] #get relationship data

        fig = gcf() #get current figure
        bar(range(len(sources)),corrs)
        title('Correlation Between Publication Review and Metascore')
        xlabel('Publication')
        ylabel('Correlation Coefficient with Metascore')
        #TODO: still need to figure out how to label each bar
        return ('This graph shows correlation blah blah',fig)
        


    
    #plot list metascore against worldwide gross
    
    
